import Vue from 'vue'
import Router from 'vue-router'
import transitionExtend from '@/utils/transition-extend'
Vue.use(Router)
const router = transitionExtend(
  new Router({
    mode: 'hash',
    // base: '/wap/',
    routes: [
      {
        path: '/',
        redirect: '/home',
        component: () => import('@/page/home.vue'),
        children: [
          // {
          //   path: '/',
          //   name: 'index',
          //   component: () => import('@/page/index/index.vue'),
          //   meta: {
          //     keepAlive: false
          //   }
          // },
          {
            path: '/home',
            name: 'home',
            component: () => import('@/page/index/index.vue'),
            meta: {
              keepAlive: false
            }
          },
          {
            path: '/me',
            name: 'me',
            redirect: '/me/dashboard',
            component: () => import('@/page/me/index.vue'),
            children: [
              {
                path: '/me/dashboard',
                name: 'dashboard',
                component: () => import('@/page/dashboard/index.vue'),
                meta: {
                  keepAlive: false
                }
              },
              {
                path: '/me/wallet',
                name: 'wallet',
                redirect: '/me/wallet/rechargeRecord',
                component: () => import('@/page/wallet/index.vue'),
                meta: {
                  keepAlive: false
                },
                children: [
                  {
                    path: '/me/wallet/rechargeRecord',
                    name: 'rechargeRecord',
                    component: () => import('@/page/recharge/Record/index.vue'),
                    meta: {
                      keepAlive: false
                    }
                  },
                  {
                    //充值
                    path: '/me/wallet/recharge',
                    name: 'recharge',
                    component: () => import('@/page/recharge/index.vue'),
                    meta: {
                      keepAlive: false
                    }
                  },
                  {
                    path: '/me/wallet/withdrawRecord',
                    name: 'withdrawRecord',
                    component: () => import('@/page/withdraw/Record/index.vue'),
                    meta: {
                      keepAlive: false
                    }
                  },
                  {
                    //提现
                    path: '/me/wallet/withdraw',
                    name: 'withdraw',
                    component: () => import('@/page/withdraw/index.vue'),
                    meta: {
                      keepAlive: false
                    }
                  }
                ]
              },
              {
                //商品收藏
                path: '/me/collectGoods',
                name: 'collectGoods',
                component: () => import('@/page/CollectGoods/index.vue'),
                meta: {
                  keepAlive: false
                }
              },
              {
                //店铺收藏
                path: '/me/collectShop',
                name: 'collectShop',
                component: () => import('@/page/CollectShop/index.vue'),
                meta: {
                  keepAlive: false
                }
              },
              {
                //设置
                path: '/me/Setting',
                name: 'Setting',
                component: () => import('@/page/Setting/index.vue'),
                meta: {
                  keepAlive: false
                }
              },
              {
                //资金密码设置
                path: '/me/Setting/FundPasswordSettings',
                name: 'FundPasswordSettings',
                component: () => import('@/page/FundPasswordSettings/index.vue'),
                meta: {
                  keepAlive: false
                }
              },
              {
                //资金密码重置
                path: '/me/Setting/FundPasswordReset',
                name: 'FundPasswordReset',
                component: () => import('@/page/FundPasswordReset/index.vue'),
                meta: {
                  keepAlive: false
                }
              },
              {
                // 收货地址
                path: '/me/Setting/AddressList',
                name: 'AddressList',
                component: () => import('@/page/AddressList/index.vue'),
                meta: {
                  keepAlive: false
                }
              },
              {
                //登录密码重置
                path: '/me/Setting/LoginPasswordReset',
                name: 'LoginPasswordReset',
                component: () => import('@/page/LoginPasswordReset/index.vue'),
                meta: {
                  keepAlive: false
                }
              },
              {
                // 注销账号
                path: '/me/Setting/cancellation',
                name: 'cancellation',
                component: () => import('@/page/accountCancellation/index.vue'),
                meta: {
                  keepAlive: false
                }
              },
              {
                //我的订单
                path: '/me/order',
                name: 'Order',
                component: () => import('@/page/Order/index.vue'),
                meta: {
                  keepAlive: false
                }
              },
              {
                //订单详情
                path: '/me/order/orderDetails',
                name: 'OrderDetails',
                component: () => import('@/page/Order/Details/index.vue'),
                meta: {
                  keepAlive: false
                }
              },
              {
                //评价嗮单  EvaluationSheet
                path: '/me/order/EvaluationSheet',
                name: 'EvaluationSheet',
                component: () => import('@/page/EvaluationSheet/index.vue')
              },
              {
                //评价  AllReviews
                path: '/me/order/AllReviews',
                name: 'AllReviews',
                component: () => import('@/page/AllReviews/index.vue')
              },
              {
                //订单物流信息
                path: '/me/order/logistics',
                name: 'OrderLogistics',
                component: () => import('@/page/Order/Logistics/index.vue')
              },
              {
                //订单评价
                path: '/me/order/orderEvaluate',
                name: 'OrderEvaluate',
                component: () => import('@/page/Order/Evaluate/index.vue')
              },
              {
                //退款申请
                path: '/me/order/orderRefund',
                name: 'OrderRefund',
                component: () => import('@/page/Order/Refund/index.vue')
              },
              {
                //退款申请
                path: '/me/order/PendingPayment',
                name: 'PendingPayment',
                component: () => import('@/page/PendingPayment/index.vue')
              }
            ]
          },
          {
            path: '/commodity',
            name: 'commodity',
            component: () => import('@/page/commodity/index.vue')
          }
        ],
        meta: {
          keepAlive: false
        }
      },
      {
        path: '*',
        redirect: '/home',
        meta: {
          keepAlive: false
        }
      },
      // 搜索页面
      {
        path: '/Search',
        name: 'Search',
        component: () => import('@/page/Search/index.vue'),
        meta: {
          keepAlive: false
        }
      },
      {
        //语言设置
        path: '/language',
        name: 'language',
        component: () => import('@/page/language/index.vue'),
        meta: {
          keepAlive: false
        }
      },
      {
        path: '/iframe',
        name: 'iframe',
        component: () => import('@/page/me/iframe.vue')
      },
      {
        path: '/complaint',
        name: 'complaint',
        component: () => import('@/page/complaint/index.vue')
      },
      {
        //贷款申请
        path: '/loan',
        name: 'loan',
        component: () => import('@/page/loan/index.vue'),
        meta: {
          keepAlive: false
        }
      },
      {
        //贷款申请表单页
        path: '/loan/apply',
        name: 'loanApply',
        component: () => import('@/page/loanApply/index.vue'),
        meta: {
          keepAlive: false
        }
      },
      {
        //贷款申请表单页
        path: '/loan/my',
        name: 'loanMy',
        component: () => import('@/page/loanMy/index.vue'),
        meta: {
          keepAlive: false
        }
      },
      {
        //预计还款表单页
        path: '/repayment/expected',
        name: 'loanExpected',
        component: () => import('@/page/loanExpected/index.vue'),
        meta: {
          keepAlive: false
        }
      },
      {
        //客服
        path: '/customerService',
        name: 'customerService',
        component: () => import('@/page/customerService/index1.vue')
      },
      {
        //客服2
        path: '/customerService2',
        name: 'customerService2',
        component: () => import('@/page/customerService/index.vue')
      },
      {
        //客服 引导
        path: '/customerServiceIndex',
        name: 'customerServiceIndex',
        component: () => import('@/page/customerServiceIndex/index.vue')
      },
      {
        path: '/login',
        name: 'login',
        component: () => import('@/page/login/index.vue')
      },
      {
        path: '/register',
        name: 'register',
        component: () => import('@/page/register/index.vue')
      },
      // {
      //     path: '/forgetPassword',  // 忘记密码
      //     name: 'ForgetPassword',
      //     component: () => import('@/page/ForgetPassword/index.vue')
      // },
      {
        //充值记录详情
        path: '/rechargeRecordDetails',
        name: 'rechargeRecordDetails',
        component: () => import('@/page/recharge/RecordDetails/index.vue')
      },
      {
        //提现记录详情
        path: '/withdrawRecordDetails',
        name: 'withdrawRecordDetails',
        component: () => import('@/page/withdraw/RecordDetails/index.vue')
      },
      {
        //完成页面
        path: '/SubmitCompleted',
        name: 'SubmitCompleted',
        component: () => import('@/page/SubmitCompleted/index.vue')
      },
      // 店铺页面
      {
        path: '/shop',
        name: 'shop',
        component: () => import('@/page/shop/index.vue'),
        meta: {
          keepAlive: false
        }
      },
      {
        //商品详情
        path: '/CommodityDetails',
        name: 'CommodityDetails',
        component: () => import('@/page/CommodityDetails/index.vue')
      },
      {
        // 店铺搜索
        path: '/store/search',
        name: 'storeSearch',
        component: () => import('@/page/storeSearch/index.vue'),
        meta: {
          keepAlive: false
        }
      },
      {
        //下单支付成功
        path: '/SuccessfulOperation',
        name: 'SuccessfulOperation',
        component: () => import('@/page/SuccessfulOperation/index.vue')
      },
      {
        //订单确认
        path: '/orderComnfirmation',
        name: 'orderComnfirmation',
        component: () => import('@/page/orderComnfirmation/index.vue'),
        meta: {
          keepAlive: false
        }
      },
      {
        //分类查询
        path: '/Classification',
        name: 'Classification',
        component: () => import('@/page/Classification/index.vue')
      },
      {
        //商家端下载
        path: '/merchantDown',
        name: 'merchantDown',
        component: () => import('@/page/Merchant/merchantDown.vue')
      },
      {
        //商家入驻
        path: '/merchantSettled',
        name: 'merchantSettled',
        component: () => import('@/page/Merchant/merchantSettled.vue')
      },
      {
        // 手机绑定
        path: '/BindPhone',
        name: 'BindPhone',
        component: () => import('@/page/BindPhone/index.vue')
      },
      {
        // 手机绑定 - 已绑定
        path: '/BindPhoneBound',
        name: 'BindPhoneBound',
        component: () => import('@/page/BindPhone/Bound/index.vue')
      },
      {
        // 邮箱绑定
        path: '/BindEmail',
        name: 'BindEmail',
        component: () => import('@/page/BindEmail/index.vue')
      },
      {
        // 邮箱绑定 - 已绑定
        path: '/BindEmailBound',
        name: 'BindEmailBound',
        component: () => import('@/page/BindEmail/Bound/index.vue')
      },
      {
        // 消息中心
        path: '/information',
        name: 'Information',
        component: () => import('@/page/Information/index.vue')
      },
      {
        // 银行卡充值
        path: '/bank-card',
        name: 'bankCard',
        component: () => import('@/page/recharge/bankCard/index.vue')
      },
      {
        // 送货和取货
        path: '/delivery',
        name: 'Delivery',
        component: () => import('@/page/Delivery/index.vue')
      }
    ]
  })
)
router.beforeEach((to, from, next) => {
  sessionStorage.setItem('upperLevel', from.path)
  next()
})
export default router
